<?php

/**
 * announcement components.
 *
 * @package    cpfaizenay
 * @subpackage announcement
 * @author     Manu
 * @version    1.0
 */
class eventComponents extends sfComponents
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeHomeShow(sfWebRequest $request)
  {
    $this->pager = new sfDoctrinePager(
        'Event',
        sfConfig::get('app_events_max_events_on_homepage')
      );

    $this->pager->setQuery(Doctrine::getTable('Event')->getEvents());
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();
    $this->events_list =  $this->pager;
  }

  public function executeListEvents(sfWebRequest $request) {
      $this->eventsList = Doctrine::getTable('Event')->getEvents()->execute();
  }
}
